package licode.unisop.client.feign;

import licode.unisop.client.info.*;
import licode.unisop.client.utils.SopAuthConst;
import licode.unisop.client.utils.SopResult;
import licode.unisop.client.vo.SopUser;
import licode.unisop.client.vo.SopUserBrief;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 登录外部调用封装
 *
 * @author licode
 */
@FeignClient(name = "${uni-sop.service:uni-auth-service}", url = "${uni-sop.host:}")
public interface SoUserVisitFeign {
    @PostMapping("/user-api/v1/internal/user/cache/update")
    SopResult<Object> updateCache(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SopUserIdIn userIn);

    @PostMapping("/user-api/v1/internal/user/save")
    SopResult<SopUser> saveUser(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SopUser userIn);

    @PostMapping("/user-api/v1/internal/user/password/reset")
    SopResult<Object> resetPassword(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SopResetPasswordIn passwordIn);

    @PostMapping("/user-api/v1/internal/user/account/save")
    SopResult<Object> saveAccount(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SopAccountIn accountIn);

    @PostMapping("/user-api/v1/internal/user/identity/save")
    SopResult<Object> saveIdentity(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SopIdentityIn identityIn);

    @PostMapping("/user-api/v1/internal/user/query/lookup-brief")
    SopResult<SopUserBrief> lookupUserBriefById(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SopUserIdFind req);

    @PostMapping("/user-api/v1/internal/user/query/lookup-brief-account")
    SopResult<SopUserBrief> lookupUserBriefByAccount(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SoUserAccountIn req);

    @PostMapping("/user-api/v1/internal/user/query/lookup")
    SopResult<SopUser> lookupUserById(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SopUserIdFind req);

    @PostMapping("/user-api/v1/internal/user/query/lookup-account")
    SopResult<SopUser> lookupUserByAccount(
            @RequestParam(SopAuthConst.PLATFORM_TOKEN) String platId,
            @RequestParam(SopAuthConst.MODAL_TOKEN) String mToken,
            @RequestBody SoUserAccountIn req);
}
